package com.tt.job.util;

import org.springframework.context.ApplicationContext;

public class SpringUtils {
    private static ApplicationContext context;

    public static <T> T getBean(Class<T> classOfT) {
        if (context == null) {
            return null;
        }
        return context.getBean(classOfT);
    }

    public static void setContext(ApplicationContext context) {
        SpringUtils.context = context;
    }
}
